package com.pms.filter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import com.pms.utils.ConfigManage;
import com.pms.utils.Constant;

public class GlobleInterceptor implements HandlerInterceptor{
	private static String resurl=ConfigManage.getInstance().getConfig(Constant.RESURL);
	@Override
	public void afterCompletion(HttpServletRequest req,
			HttpServletResponse resp, Object arg2, Exception arg3)
			throws Exception {
		
	}

	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response,
			Object obj, ModelAndView mv) throws Exception {
		if(mv!=null){
			mv.addObject("resurl", resurl);
		}else{
			request.setAttribute("resurl", resurl);
		}
	}

	@Override
	public boolean preHandle(HttpServletRequest req, HttpServletResponse resp,
			Object arg2) throws Exception {
		return true;
	}

}
